<template>
  <div>
    <!-- 头部 -->
    <van-search placeholder="请输入搜索关键词" @focus="toSearch"/>
    <!-- 轮播 -->
    <Banner />

    <!-- 列表 -->
    <List :list="list"/>
  </div>
</template>

<script>
import Banner from '@/components/Banner'
import List from '@/components/List'
import axios from 'axios'
export default {
  name: 'Index',
  data() {
    return {
      list: []
    }
  },
  methods: {
    toSearch() {
      this.$router.push({ name: 'search' })
    },
  },
  components: {
    Banner,
    List
  },
  mounted() {
    axios.get('/list').then(resp => {
      console.log(resp.data);
      this.list = resp.data.data
    })
  }
}
</script>


